#ifndef REALTIME_SERVER_THREAD_H_H
#define  REALTIME_SERVER_THREAD_H_H

#include <QThread>
#include <QSemaphore>

class RealTimeServerThread : public QThread
{
	Q_OBJECT
public:
	static RealTimeServerThread* instance();
	void waitForStart()
	{
		m_StartSemaphore.acquire();
	}
	unsigned short getVideoPort() const
	{
		return m_VideoPort;
	}
	unsigned short getAudioPort() const
	{
		return m_AudioPort;
	}
signals:
	void errorHappended();
protected:
	void run();
private:
	RealTimeServerThread();
	void setStarted()
	{
		m_StartSemaphore.release();
	}
private:
	int m_VideoServerSocket;
	int m_AudioServerSocket;
	unsigned short m_VideoPort;
	unsigned short m_AudioPort;
	QSemaphore m_StartSemaphore;
};

#endif